import React, { Component } from 'react';
import { observer, inject } from 'mobx-react';
import { NavBar, Icon, Button } from 'antd-mobile';
import { withRouter } from 'react-router-dom';
import MainComp from './components/Main';
import styles from './index.scss';

@inject('AppStore')
@withRouter
@observer
class Home extends Component {
  constructor(props, context) {
    super(props, context);
    this.AppStore = this.props.AppStore;
    this.state = {};
  }

  componentDidMount() {
    this.AppStore.reqMenu();
  }

  componentWillUnmount() { }

  render() {
    return (
      <div className={styles['home-container']}>
        <NavBar
          mode="light"
          className="nav-bar"
          icon={<Icon type="left" />}
          onLeftClick={() => console.log('onLeftClick')}
          rightContent={[
            <Icon key="0" type="search" style={{ marginRight: '16px' }} />,
            <Icon key="1" type="ellipsis" />,
          ]}
        >首页</NavBar>
        <Button type="primary">default</Button>
        <MainComp />
      </div>
    );
  }
}

export default Home;
